﻿using System.Collections.Generic;
using System.Threading;

namespace JavaVirtualMachine
{
    public static class ThreadManager
    {
        //public static List<Thread> Threads = new List<Thread>();
        public static Dictionary<int,Thread> Threads = new Dictionary<int, Thread>();

        public static int ThreadAddr = 0;
        public static int GetCurrentThread()
        {
            //System.Threading.Thread thread = new System.Threading.Thread(() => { });
            Thread thread = Thread.CurrentThread;
            //ThreadAddr = 0;
            foreach (var item in Threads)
            {
                if (item.Value == thread)
                {
                    ThreadAddr = item.Key;
                    break;
                }
            }
            return ThreadAddr;
        }

    }
}
